package com.cenntro.oss.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cenntro.common.base.BaseController;
import com.cenntro.common.util.ConvertorUtils;
import com.cenntro.common.util.result.Result;
import com.cenntro.oss.model.dbo.DevCertificateDO;
import com.cenntro.oss.model.qo.DevCertificateQO;
import com.cenntro.oss.service.DevCertificateService;

import io.swagger.annotations.Api;

/**
 * <p>
 * 车辆合格证信息
 * </p>
 *
 * @author
 * @since 2018-12-08
 */

@Api(value = "合格证细信息表", tags = { "合格证细信息表" })
@RestController
@RequestMapping("/devCert")
public class DevCertificateController extends BaseController {

	@Resource
	private DevCertificateService devCertificateService;

	/**
	 * 
	* @Title addOrUpdate
	* @Description 合格证增加或者修改
	* @param qo
	* @return  
	* @throws
	 */
	@RequestMapping("/addOrUpdate")
	public Result addOrUpdate(DevCertificateQO qo) {
		DevCertificateDO dcdo = ConvertorUtils.deepConvert(qo, DevCertificateDO.class);
		if (dcdo.getCertId() != null && dcdo.getCertId() > 0) {
			devCertificateService.update(dcdo);
		} else {
			devCertificateService.insert(dcdo);
		}
		return Result.ok();
	}

}
